package cn.hdy.org.controller;

import cn.hdy.base.util.AjaxResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotBlank;

@Validated
@RestController
public class UserController{
    /*
        @RequestParam - 1.获取?后面key=value的方式的数据 2.当请求参数名与方法参名一样的时候可以省略掉
     */
    //前端传参格式：/user/add?name=xxx&password=xxx
    @GetMapping("/login")
    public AjaxResult login(
            @RequestParam("name") @NotBlank(message="用户名不能为空") String username,
            @NotBlank(message="密码不能为空")String password){
        System.out.println(username);
        System.out.println(password);
        return new AjaxResult();
    }
}